package com.cndw.kungfu.model.pet;

import java.util.Collection;
import java.util.Map;
import java.util.Set;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cndw.kungfu.core.cache.CachePet;
import com.cndw.kungfu.domain.Pet;
import com.cndw.kungfu.domain.PetMode;
import com.cndw.kungfu.model.pet.domain.PetSoul;

/**
 * 宠物相关服务接口
 * @author fantadust [9677889@qq.com]
 * @date 2012-4-7 下午2:44:59
 */
@Service
public class PetServer {
	@Autowired
	private PetManager petManager;
	@Autowired
	private CachePet cachePet;
	
	public Pet insert(long playerId,int modeId, int growth){
		return petManager.insert(playerId, modeId,growth);
	}
	
	
	/**
	 * 获取指定等级的宠物配置
	 * @param level
	 * @return
	 */
	public PetMode getPetMode(int modeId){
		return cachePet.getOne(modeId);
	}
	public Set<String> getPetNames(){
		return cachePet.getPetNames();
	}


	public Map<Long, Pet> getPetsMap(long playerId) {
		return petManager.getPetsDB(playerId);
	}


	public PetSoul getSoul(int type, int color,int level) {
		return cachePet.getPetSoul(type, color, level);
	}
	public Collection<PetSoul> getSouls(){
		return cachePet.getPetSouls();
	}
	
	public PetSoul getSoul(int id){
		return cachePet.getPetSoul(id);
	}
}
